package org.dromara.patrol.domain;

import org.dromara.common.mybatis.handler.ListInteger2ListLongTypeHandler;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.patrol.domain.model.snap.DeviceChannel;
import org.dromara.patrol.domain.model.snap.SnapExecuteRule;

import java.io.Serial;
import java.util.List;

/**
 * 巡店管理-巡店抓拍配置对象 patrol_snap_plan
 *
 * @author LionLi
 * @date 2024-03-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "patrol_snap_plan",autoResultMap = true)
public class PatrolSnapPlan extends TenantEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 计划id
     */
    @TableId(value = "plan_id")
    private Long planId;

    /**
     * 计划名称
     */
    private String planName;

    /**
     * 定时任务id
     */
    @TableField(typeHandler = ListInteger2ListLongTypeHandler.class)
    private List<Long> cycleTaskIds;

    /**
     * 门店id
     */
    private Long storeId;

    /**
     * 设备ids
     */
    @TableField(typeHandler = ListInteger2ListLongTypeHandler.class)
    private List<Long> deviceIds;

    /**
     * 设备通道[
{
"deviceId": "24f2303f-8525-11ee-9bed-0329e3f31fb1","channelNo": [
0,
1,
2,
3
]},
{
"deviceId": "60178e90-e119-11ea-9b05-49adcdf3e65a","channelNo": null}
]
     */
    @TableField(typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private List<DeviceChannel> deviceChannel;

    /**
     * 设备预设点
     */
    private String devicePresetPoint;

    /**
     * 最新抓拍地址
     */
    private String latestImgUrl;

    /**
     * 快照总计
     */
    private Long snapTotal;

    /**
     * 当前状态(0启用 1关闭)
     * @see org.dromara.common.core.enums.patrol.snap.PlanStatus
     */
    private String status;

    /**
     * 拍照时间、循环周期（如：{
                "cycleType": "WEEKLY",
                "weeklyRule": [
                    2,
                    3,
                    4,
                    5,
                    6
                ],
                "customRule": null,
                "snapTime": [
                    {
                        "startTime": "08:30",
                        "endTime": "09:00",
                        "interval": 600
                    }
                ]
            }）
     */
    @TableField(typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class)
    private SnapExecuteRule executeRule;

    /**
     * 检查编号
     */
    private Long inspectedNum;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    @TableLogic
    private String delFlag;

    /**
     * 抓拍模式（字典表：COMMON 普通抓拍，LOCATION 预置位抓拍）
     * @see org.dromara.common.core.enums.patrol.snap.SnapModelType
     */
    private String snapModel;

    /**
     * 预计抓拍图片总数
     */
    private Long expectSnapTotal;


}
